/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "插座类JIT函数.h"

#include <omp.h>
#include <matXX.h>
#include <graph采样.h>
#include <core/动画/curve.h>
#include <core/设备内存缓存.h>


S_GPU内存块 f_JIT_alloc_GPU_F32_1D(S_F32Array* a) {
	S_GPU内存块 块 = f_bm_alloc(f_buf_getGlobal().m_F32动态属性, a->count);
	f_gbuf_fill(块, a->ptr_userData, 0, a->count);

	return 块;
}
S_GPU内存块 f_JIT_alloc_GPU_I32_1D(S_I32Array* a) {
	S_GPU内存块 块 = f_bm_alloc(f_buf_getGlobal().m_I32动态属性, a->count);
	f_gbuf_fill(块, a->ptr_userData, 0, a->count);

	return 块;
}
S_GPU内存块 f_JIT_alloc_GPU_UI32_1D(S_UI32Array* a) {
	S_GPU内存块 块 = f_bm_alloc(f_buf_getGlobal().m_UI32动态属性, a->count);
	f_gbuf_fill(块, a->ptr_userData, 0, a->count);

	return 块;
}
S_GPU内存块 f_JIT_alloc_GPU_Vec2_1D(S_Vec2Array* a) {
	S_GPU内存块 块 = f_bm_alloc(f_buf_getGlobal().m_Vec2动态属性, a->count);
	f_gbuf_fill(块, a->ptr_userData, 0, a->count);

	return 块;
}
S_GPU内存块 f_JIT_alloc_GPU_Vec3_1D(S_Vec3Array* a) {
	S_GPU内存块 块 = f_bm_alloc(f_buf_getGlobal().m_Vec3动态属性, a->count);
	f_gbuf_fill(块, a->ptr_userData, 0, a->count);

	return 块;
}


//void f_JIT_clear_GPU_1D(S_GPU内存块索引& r) {
//	f_bm_erase(r);
//}


void f_node_所有插座类JIT初始化() {
	
	//f_代码构建_添加JIT初始化函数指针(DEF_S(f_buf_getOffsetAddress), DEF_S(uint64), "S_GPU内存块索引& 块, uint64 offset", f_buf_getOffsetAddress);

	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_alloc_GPU_F32_1D), DEF_S(S_GPU内存块), "S_F32Array* a", f_JIT_alloc_GPU_F32_1D);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_alloc_GPU_I32_1D), DEF_S(S_GPU内存块), "S_I32Array* a", f_JIT_alloc_GPU_I32_1D);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_alloc_GPU_UI32_1D), DEF_S(S_GPU内存块), "S_UI32Array* a", f_JIT_alloc_GPU_UI32_1D);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_alloc_GPU_Vec2_1D), DEF_S(S_GPU内存块), "S_Vec2Array* a", f_JIT_alloc_GPU_Vec2_1D);
	f_代码构建_添加JIT初始化函数指针(DEF_S(f_JIT_alloc_GPU_Vec3_1D), DEF_S(S_GPU内存块), "S_Vec3Array* a", f_JIT_alloc_GPU_Vec3_1D);


	f_代码构建_添加JIT初始化函数指针(DEF_S(f_bm_erase), DEF_S(void), "S_GPU内存块& a", f_bm_erase);
}



